"use client"; /** * /w/:workspace/settings/permissions — access reference. * * The server resolves the effective level (apps/api/src/lib/authorize.ts) as: * baseline from the workspace role (ROLE_LEVEL) MAXED with the most-specific * per-resource `Permission` grant for the caller. * * Role → baseline level (ROLE_LEVEL): * OWNER → FULL_ACCESS, ADMIN → FULL_ACCESS, MEMBER → EDIT, GUEST → VIEW * Levels: NONE < VIEW < COMMENT < EDIT < FULL_ACCESS. * * IMPORTANT (flagged to the core agent): there are NO REST endpoints to list, * create, or delete per-resource `Permission` rows — they are enforced * server-side only and not yet surfaced in an API. So this page is a read-only * reference of the real model + the role→level matrix, not an editor. When a * permissions API is added, the grant editor can be built on top of this layout. */ import { useParams } from "next/navigation"; import { ShieldCheck, Info } from "lucide-react"; import { useWorkspace } from "@/hooks/use-workspace"; import { SettingsShell, Section } from "@/components/settings/settings-shell"; const LEVELS = ["NONE", "VIEW", "COMMENT", "EDIT", "FULL_ACCESS"] as const; const LEVEL_DESC: Record = { NONE: "No access.", VIEW: "Can read content.", COMMENT: "Can view and comment.", EDIT: "Can view, comment, and edit content.", FULL_ACCESS: "Can view, comment, edit, share, and manage settings." }; const ROLE_LEVEL: { role: string; level: string }[] = [ { role: "OWNER", level: "FULL_ACCESS" }, { role: "ADMIN", level: "FULL_ACCESS" }, { role: "MEMBER", level: "EDIT" }, { role: "GUEST", level: "VIEW" } ]; export default function SettingsPermissionsPage() { const params = useParams<{ workspace: string }>(); const slugOrId = params?.workspace ?? ""; const { data: ws } = useWorkspace(slugOrId); const currentRole = (ws?.role ?? "").toUpperCase(); return (
    {LEVELS.map((lvl) => (
  • {lvl} {LEVEL_DESC[lvl]}
  • ))}
{ROLE_LEVEL.map((r) => ( ))}
Role Baseline level
{r.role} {currentRole === r.role ? ( you ) : null} {r.level}

Your effective level on any resource is the maximum of your role's baseline level and the most specific per-resource grant that applies.

Fine-grained grants (per page, database, teamspace, or record, for a specific user or team) are enforced server-side. A management surface for these grants isn't exposed in the API yet, so they can't be edited here.

All checks are authoritative on the server; the client never trusts its own role.

); }